package com.sangeng.controller;

import com.sangeng.entity.ResponseResult;
import com.sangeng.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/content")
public class ArticleController {
@Autowired
ArticleService articleService;
//    @GetMapping("/article/list")
//    public ResponseResult getArticleList(Integer pageNum,Integer pageSize){
//
//
//        return articleService.getArticleList(pageNum,pageSize,null);
//
//    }

    @DeleteMapping("/article/{idList}")
    public ResponseResult deleteArticleList(@PathVariable List<Long> idList){


       return articleService.deleteArticleList(idList);
    }

    @GetMapping("/article/{id}")
    public ResponseResult getArticle(@PathVariable Long id){


        return articleService.getArticleById(id);

    }

    /**
     * 根据titel查询文章
     * @param pageNum
     * @param pageSize
     * @param title
     * @return
     */
    @GetMapping("/article/list")
    public ResponseResult getArticleListByTitle(Integer pageNum,Integer pageSize,String title,String summary){


        return articleService.getArticleByTitle(pageNum,pageSize,title,summary);

    }


}
